<?php

namespace mpend\modules\cms\controllers;

use Yii;
use mpend\components\Controller;
use mpend\modules\cms\models\ArticleSearch;
use mpend\modules\cms\models\ArticleView;

/**
 * 页面tabs
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class ArticleController extends Controller {

    /**
     * @inheritdoc
     */
    protected function verbs() {
        return [
            '*' => ['GET']
        ];
    }

    /**
     * @inheritdoc
     */
    public function actionIndex() {
        $model = new ArticleSearch();
        $model->load(Yii::$app->request->getQueryParams(), '');
        return $model->search();
    }

    /**
     * {@inheritdoc}
     */
    public function actions() {
        return [
            'view' => [
                'class' => 'yii\rest\ViewAction',
                'modelClass' => ArticleView::class,
            ],
        ];
    }

}
